home *** CD-ROM | disk | FTP | other *** search
/ Rat Attack (UK) (Digital Press Kit - Summer '99) / Rat Attack (UK) (Digital Press Kit - Summer '99).bin / RAT01.DIR / 00025_Script_UI Pushbutton < prev    next >
Text File  |  1999-04-26  |  2KB  |  79 lines

  1. -- Button Pushbutton
  2.  
  3.  
  4. -- a control
  5. property UpCM, DownCM, UpNum, DownNum
  6. property button_active
  7.  
  8.  
  9. on mouseDown me
  10.   set the member of sprite (the spriteNum of me) = member the downCM of me
  11.   set the button_active of me = TRUE
  12. end
  13.  
  14. on mouseUp me
  15.   set the member of sprite (the spriteNum of me) = member the UpCM of me
  16.   set the button_active of me = false
  17. end
  18.  
  19. on mouseEnter me
  20.   if the button_active of me then
  21.     set the member of sprite (the spriteNum of me) = member the DownCM of me
  22.   end if
  23. end  
  24.  
  25. on mouseLeave me
  26.   if the button_active of me then
  27.     set the member of sprite (the spriteNum of me) = member the UpCM of me
  28.   end if 
  29. end
  30.  
  31. on mouseUpOutside me
  32.   -- mouse leave will set the picture to up
  33.   set the button_active of me = false
  34. end
  35.  
  36. ---
  37.  
  38. on beginSprite me
  39.   
  40.   set the UpCM of me = the member of sprite (the spriteNum of me)  
  41.   set the UpNum of me = the number of member UpCM
  42.   
  43.   set the DownNum of me = the number of member DownCM
  44.   
  45.   set the button_active of me = false
  46.   
  47.   -- puppetSprite the spriteNum of me, TRUE
  48. end
  49.  
  50. on endSprite me
  51.   -- puppetSprite the spriteNum of me, FALSE
  52. end
  53.  
  54. on getPropertyDescriptionList
  55.   if the currentspritenum = 0 then 
  56.     set memdefault = 0 
  57.   else
  58.     set memref = the member of sprite the currentspritenum
  59.     set castlibnum = the castlibnum of memref
  60.     set memdefault = member (the membernum of member memref + 1) of castlib castlibnum
  61.   end if
  62.   
  63.   set p_list = [ ¼
  64.         #DownCM: [ #comment:   "Hilite Image:", ¼
  65.                     #format:   #graphic, ¼
  66.                    #default:    memdefault ] ¼
  67.                  ]
  68.   return p_list  
  69. end
  70.  
  71. on getBehaviorDescription
  72.   return ¼
  73. "Makes a sprite work as a pushbutton with automatic highlighting and mouse tracking. The sprite's initial castmember represents the button's normal state." & RETURN & ¼
  74. "PARAMETERS:" & RETURN & ¼
  75. "ò Hilite Image - Choose the cast member to display when the button is pressed. The default value is the cast member immedietly following the sprite's current cast member."  
  76.   
  77. end
  78.  
  79.